function [lpostmin,xestmode,estimiter,exitflag,tiempo]=lmj_postoptim_csminwel(xzero,partrmat_est,parvecmode,parposest,estimopt,funcmod,Y,trainvec,prpar,prss,solveopt,addsol,ssposest)
% lmjMinCsminwel
tic;
%% 1. Assign default values
lpostmin  = inf;
xestmode  = nan(length(xzero),1);
estimiter =-1;
exitflag  =-10;
flag_ok   =0;

%% 2. Transform XZERO into XZEROMIN, return if any value is imaginary
xzeromin          = feval(@mod2min,xzero,partrmat_est);
if any( imag(xzeromin) ) || any( isnan(xzeromin) )
    disp('Imaginary Starting Value')
    return
end

funcname=@lmj_postoptim_central;
%% 3. Call CSMINWEL
[lpostmin,xestmin,~,~,estimiter,~,exitflag]=...
    feval(@csminwel_silent,funcname,xzeromin,0.25*eye(length(xzeromin)),[],estimopt.TolFun,estimopt.MaxIter,...
    parvecmode,parposest,partrmat_est,funcmod,Y,trainvec,prpar,prss,solveopt,addsol,ssposest,1);

%% 4. Retrive xestmode, return if any value nan or imaginart
xestmode  = feval(@min2mod,xestmin,partrmat_est);
if any( imag(xestmode) ) || any( isnan(xestmode) )
    lpostmin  = inf;
    xestmode  = nan(length(xzero),1);
else
    flag_ok=1;
end
tiempo=toc;